package com.ddogring.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ddogring.business.domain.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @BelongsProject: eshop
 * @BelongsPackage: com.ddogring.business.mapper
 * @Author: DdogRing
 * @CreateTime: 2023-01-30  11:21
 * @Description: TODO
 * @Version: 1.0
 */
@Mapper
@Repository
public interface CommentMapper extends BaseMapper<Comment> {

    /**
     * @description: 根据商品id查询评论
     * @author: DdogRing
     * @date: 2023/2/1 16:28
     * @param: [commodityId]
     * @return: java.util.List<com.ddogring.business.domain.Comment>
     **/
    List<Comment> selectByCommodityId(Integer commodityId);

    /**
     * @description: 单商品评价列表
     * @author: DdogRing
     * @date: 2023/2/9 17:41
     * @param: [commodityId]
     * @return: java.util.List<com.ddogring.business.domain.Comment>
     **/
    @Select("select * from t_comment where commodity_id = #{commodityId} and del_flag = '0'")
    List<Comment> getCommentByCommodityId(Integer commodityId);
}
